<%@ tag language="java" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%@ attribute name="content" type="java.lang.String" required="true" description="消息内容"%>
<%@ attribute name="type" type="java.lang.String" description="消息类型：info、success、warning、error、loading"%>
<%@ attribute name="glyphicon" type="java.lang.String" description="消息图标：info-sign、ok-sign、warning-sign、remove-sign"%>

<c:if test="${not empty content}">
	<c:if test="${not empty type}"><c:set var="ctype" value="${type}"/></c:if>
	<c:if test="${empty type}"><c:set var="ctype" value="${fn:indexOf(content,'失败') eq -1?'success':'error'}" /></c:if>
	<c:if test="${not empty glyphicon}"><c:set var="gtype" value="${glyphicon}"/></c:if>
	<c:if test="${empty glyphicon}"><c:set var="gtype" value="${fn:indexOf(content,'失败') eq -1?'ok-sign':'remove-sign'}" /></c:if>
	
	<div id="messageBox" class="alert alert-${ctype}"><button data-dismiss="alert" class="close">×</button><i class="glyphicon glyphicon-${gtype }" style="font-size: 18px;"></i> ${content}</div>
	<script type="text/javascript">
		 messageBox("${content}","${ctype}","${gtype}");
	</script>
</c:if>